﻿namespace UDKDevKitVSXDebugEngine.Extentions
{
    /// <summary>
    /// TODO: Update summary.
    /// </summary>
    public class ConstAllowableExpression : DebuggerExpression
    {
        private string code;

        public ConstAllowableExpression(string code, Engine engine)
            : base(code, engine)
        {
            this.code = string.IsNullOrEmpty(code) ? string.Empty : code.Trim();
        }

        public override string ToString()
        {
            if (Value == null)
            {
                if (this.code.StartsWith("\"")
                    && this.code.EndsWith("\""))
                {
                    return this.code.Substring(1, this.code.Length - 2);
                }

                return this.code;
            }

            return base.ToString();
        }
    }
}
